<div class="refentry" lang="en" xml:lang="en"><a id="glPolygonOffset"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glPolygonOffset — set the scale and units used to calculate depth values</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glPolygonOffset</b>(</code></td><td>GLfloat  </td><td><var class="pdparam">factor</var>, </td></tr><tr><td> </td><td>GLfloat  </td><td><var class="pdparam">units</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>factor</code></em></span></dt><dd><p>
                    Specifies a scale factor that is used to create a variable
                    depth offset for each polygon. The initial value is 0.
                </p></dd><dt><span class="term"><em class="parameter"><code>units</code></em></span></dt><dd><p>
                    Is multiplied by an implementation-specific value to
                    create a constant depth offset. The initial value is 0.
                </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            When <code class="constant">GL_POLYGON_OFFSET_FILL</code>, <code class="constant">GL_POLYGON_OFFSET_LINE</code>, or
            <code class="constant">GL_POLYGON_OFFSET_POINT</code> is enabled, each
            fragment's <span class="emphasis"><em>depth</em></span> value will be offset after it is interpolated
            from the <span class="emphasis"><em>depth</em></span> values of the appropriate vertices.
            The value of the offset is
            <math overflow="scroll">

                <mrow>
                    <mrow>
                        <mi mathvariant="italic">factor</mi>
                        <mo>×</mo>
                        <mi mathvariant="italic">DZ</mi>
                    </mrow>
                    <mo>+</mo>
                    <mrow>
                        <mi mathvariant="italic">r</mi>
                        <mo>×</mo>
                        <mi mathvariant="italic">units</mi>
                    </mrow>
                </mrow>
            </math>,
            where
            <math overflow="scroll">

                <mi mathvariant="italic">DZ</mi>
            </math>
            is a measurement of the change in depth relative to the screen
            area of the polygon, and
            <math overflow="scroll"><mi mathvariant="italic">r</mi></math>
            is the smallest value that is guaranteed to
            produce a resolvable offset for a given implementation.
            The offset is added before the depth test is performed and before
            the value is written into the depth buffer.
        </p><p>
            <code class="function">glPolygonOffset</code> is useful for rendering hidden-line images, for applying decals
            to surfaces, and for rendering solids with highlighted edges.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
            <code class="function">glPolygonOffset</code> is available only if the GL version is 1.1 or greater.
        </p><p>
            <code class="function">glPolygonOffset</code> has no effect on depth coordinates placed in the
            feedback buffer.
        </p><p>
            <code class="function">glPolygonOffset</code> has no effect on selection.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
            <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glPolygonOffset</code> is executed
            between the execution of <a class="citerefentry" href="glBegin"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> and the corresponding
            execution of <a class="citerefentry" href="glEnd"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
            <a class="citerefentry" href="glIsEnabled"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument
            <code class="constant">GL_POLYGON_OFFSET_FILL</code>,
            <code class="constant">GL_POLYGON_OFFSET_LINE</code>,
            or <code class="constant">GL_POLYGON_OFFSET_POINT</code>.
        </p><p>
            <a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_POLYGON_OFFSET_FACTOR</code> or
            <code class="constant">GL_POLYGON_OFFSET_UNITS</code>.
        </p></div>
        {$pipelinestall}{$examples}
        <div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a class="citerefentry" href="glDepthFunc"><span class="citerefentry"><span class="refentrytitle">glDepthFunc</span></span></a>,
            <a class="citerefentry" href="glEnable"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a>,
            <a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>,
            <a class="citerefentry" href="glIsEnabled"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a>
        </p></div><div class="refsect1" lang="en" xml:lang="en"><div id="Copyright"><h2>Copyright</h2><p>
            Copyright © 1991-2006
            Silicon Graphics, Inc. This document is licensed under the SGI
            Free Software B License. For details, see
            <a class="ulink" href="https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/" target="_top">https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/</a>.
        </p></div></div></div>
